import feffery_antd_components as fac
from dash import html

from server import app
from views import tab1, tab2, tab3, tab4, tab5, tab6

app.layout = html.Div(
    fac.AntdTabs(
        [
            fac.AntdTabPane(
                tab1.layout,
                tab='suppress_callback_exceptions',
                key='tab1',
                titleSideInfoPopover={
                    'title': '说明',
                    'content': '回调函数注册的角色在当前layout不存在'
                }
            ),
            fac.AntdTabPane(
                tab2.layout,
                tab='dash.callback_context',
                key='tab2',
                titleSideInfoPopover={
                    'title': '说明',
                    'content': '获取回调过程上下文信息'
                }
            ),
            fac.AntdTabPane(
                tab3.layout,
                tab='浏览器端回调',
                key='tab3',
                titleSideInfoPopover={
                    'title': '说明',
                    'content': '在浏览器端独立实现回调过程，不依赖服务器通信'
                }
            ),
            fac.AntdTabPane(
                tab4.layout,
                tab='模式匹配回调：MATCH',
                key='tab4'
            ),
            fac.AntdTabPane(
                tab5.layout,
                tab='模式匹配回调：ALL',
                key='tab5'
            ),
            fac.AntdTabPane(
                tab6.layout,
                tab='实战：增删改一体化表格应用',
                key='tab6'
            )
        ],
        id='tabs',
        tabPosition='left',
        style={
            'height': '100%'
        }
    ),
    style={
        'height': '100vh',
        'padding': '15px'
    }
)

if __name__ == '__main__':
    app.run_server(debug=True, port=8000, host='0.0.0.0')
